Repository navigation
Fix decoding of uncompressed 16-bit, half, float, RGB9e5 and signed texture formats - #402
Open
1915rising wants to merge 1 commit into
Open
1915rising wants to merge 1 commit into
1915rising wants to merge 1 commit into
Conversation
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #386.
Using the issue's test script (2x2 textures with known texels) against master, 18 of the 21 uncompressed formats in this family failed to decode: RG16, RG32, RHalf, RGHalf, RGBAHalf, RFloat, RGBAFloat, ARGBFloat, RGFloat and RGB9e5Float, plus all eight _SIGNED formats — with KeyErrors, struct unpack errors, unknown image modes and channel shifts. R16, RGB48 and RGBA64 already worked and are untouched.
The fix replaces the broken half()/rg() helpers in Texture2DConverter with one generic pure-Python uncompressed converter (unsigned scaled by format max, half/float clamped to [0,1] following the codebase's ASTC HDR convention, signed treated as SNORM) and reroutes the 17 affected CONV_TABLE entries to it; rgb9e5float() now rounds and clamps to [0,255].
Tests: the issue's script goes from 3 OK / 18 FAIL to 21/21 OK. New tests/test_texture2d_converter.py adds 21 tests, all passing. Full suite: 37 passed / 4 failed before, 58 passed / 4 failed after — the 4 failures are pre-existing sample-data failures, unchanged.